<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title am-cf">商户进项记录</div>
                </div>
                <div class="widget-body am-fr">
                    <!-- 工具栏 -->
                    <div class="page_toolbar am-margin-bottom-xl am-cf">
                        <form id="form-search" class="toolbar-form" action="">
                            <input type="hidden" name="s" value="/<?= $request->pathinfo() ?>">
                            <div class="am fr">

                                <div class="am-form-group am-fl">
                                    <?php $status = $request->get('status'); ?>
                                    <select name="status"
                                            data-am-selected="{btnSize: 'sm', placeholder: '分红状态'}">
                                        <option value=""></option>
                                        <option value="-1"
                                            <?= $status === '-1' ? 'selected' : '' ?>>全部
                                        </option>

                                        <?php foreach ($statusList as $k=> $attr): ?>
                                            <option value="<?= $k ?>" <?= $status == $k ? 'selected' : '' ?>>
                                                <?= $attr ?>
                                            </option>
                                        <?php endforeach; ?>
                                    </select>
                                </div>
                                <div class="am-form-group tpl-form-border-form am-fl">
                                    <input type="text" name="search_time"  class="am-form-field"  value="<?= $request->get('search_time') ?>"  placeholder="选择时间"  style="width:280px">
                                </div>
                                <div class="am-form-group am-fl">
                                    <div class="am-input-group am-input-group-sm tpl-form-border-form">
                                        <input type="text" class="am-form-field" name="search"
                                               placeholder="请输入微信昵称/商户名称"
                                               value="<?= $request->get('search') ?>">
                                        <div class="am-input-group-btn">
                                            <button class="am-btn am-btn-default am-icon-search" type="submit"></button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="am-scrollable-horizontal am-u-sm-12">
                        <table width="100%" class="am-table am-table-compact am-table-striped
                         tpl-table-black am-text-nowrap">
                            <thead>
                            <tr>
                                <th>ID</th>  
                                <th>订单号</th>
                                <th>分红商户</th>
                                <th>分红金额</th>
                                <th>支付金额</th>
                                <th>分红状态</th>
                                <th>失败原因</th>
                                <th>创建时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if (!$list->isEmpty()): foreach ($list as $item): ?>
                                <tr>
                                     <td class="am-text-middle"><?= $item['id'] ?></td>
                                    <td class="am-text-middle"><?= $item['order_no'] ?></td>
                                    <td class="am-text-middle"><?= $item['wxapp']['wxapp_name'] ?></td>
                                    <td class="am-text-middle"><?= $item['amount'] ?></td>
                                    <td class="am-text-middle"><?= $item['payment'] ?></td>
                                    <td class="am-text-middle">
                                        <?php if ($item['status'] ==0) : ?>
                                            <span class="x-color-green">待分账</span>
                                        <?php elseif ($item['status'] ==1 ) : ?>
                                            <span class="x-color-yellow">已分账</span>
                                        <?php else: ?>
                                            <span class="x-color-red">分账失败</span>
                                        <?php endif; ?>
                                    </td>
                                    <td class="am-text-left"><?= $item['fail_reason'] ?></td>
                                    <td class="am-text-middle"><?= $item['create_time'] ?></td>
                                </tr>
                            <?php endforeach; else: ?>
                                <tr>
                                    <td colspan="11" class="am-text-center">暂无记录</td>
                                </tr>
                            <?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                    <div class="am-u-lg-12 am-cf">
                        <div class="am-fr"><?= $list->render() ?></div>
                        <div class="am-fr pagination-total am-margin-right">
                            <div class="am-vertical-align-middle">总记录：<?= $list->total() ?></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>